/*
=======================================================================

  BOTS Nurse Heal Menu

=======================================================================
*/
#include "ui_local.h"
#include "ui_BOTS.h"

typedef struct 
{
  menuframework_s menu;  

  menutext_s	title;
  menutext_s	captain;
  menutext_s	bodyguard;
  menutext_s	sniper;
  menutext_s	soldier;
  menutext_s	berzerker;
  menutext_s	infiltrator;
  menutext_s	kamikazee;
  menutext_s	nurse;
  menutext_s	scientist;
  menutext_s	cancel;
} infiltratorDisguiseMenu_t;

static infiltratorDisguiseMenu_t	s_infiltratorDisguiseMenu;

/*
=================
BOTS_InfiltratorDisguiseMenu_Event
callback routine
=================
*/
void BOTS_InfiltratorDisguiseMenu_Event( void *ptr, int notification ) 
{
	int classtype = 0;

	if( notification != QM_ACTIVATED )
		return;

	// any event will kill the menu
	UI_PopMenu();

	switch( ((menucommon_s*)ptr)->id ) 
	{
	case BOTS_CANCEL:
		break;
	case BOTS_CAPTAIN:
		classtype = BOTS_CAPTAIN;
		break;
	case BOTS_BODYGUARD:
		classtype = BOTS_BODYGUARD;
		break;
	case BOTS_SNIPER:
		classtype = BOTS_SNIPER;
		break;
	case BOTS_SOLDIER:
		classtype = BOTS_SOLDIER;
		break;
	case BOTS_BERZERKER:
		classtype = BOTS_BERZERKER;
		break;
	case BOTS_INFILTRATOR:
		classtype = BOTS_INFILTRATOR;
		break;
	case BOTS_KAMIKAZEE:
		classtype = BOTS_KAMIKAZEE;
		break;
	case BOTS_NURSE:
		classtype = BOTS_NURSE;
		break;
	case BOTS_SCIENTIST:
		classtype = BOTS_SCIENTIST;
		break;

	// oops - not a valid choice
	default:
		Com_Printf("%i is not a valid choice\n", ((menucommon_s*)ptr)->id);
		break;
	}

	if (classtype != 0)
		trap_Cmd_ExecuteText( EXEC_APPEND, va("UI_to_server_disguise %i\n", classtype));

}

/*
=================
BOTS_InfiltratorDisguiseMenu_Init
- pretty much copied from BOTS_MainMenu_Init
=================
*/
void BOTS_InfiltratorDisguiseMenu_Init() 
{
	int		y;

	memset( &s_infiltratorDisguiseMenu, 0 ,sizeof(infiltratorDisguiseMenu_t) );
	s_infiltratorDisguiseMenu.menu.wrapAround = qtrue;
	s_infiltratorDisguiseMenu.menu.fullscreen = qfalse;

	y = 96;
	s_infiltratorDisguiseMenu.title.generic.type	= MTYPE_PTEXT;
	s_infiltratorDisguiseMenu.title.generic.flags	= QMF_CENTER_JUSTIFY;
	s_infiltratorDisguiseMenu.title.generic.x		= 320;
	s_infiltratorDisguiseMenu.title.generic.y		= y;
	s_infiltratorDisguiseMenu.title.string			= "INFILTRATOR DISGUISE MENU";
	s_infiltratorDisguiseMenu.title.color			= color_bots_menu;
	s_infiltratorDisguiseMenu.title.style			= UI_CENTER|UI_SMALLFONT;
	
	// skip a space
	y += BOTS_VERTICAL_SPACING;

	y += BOTS_VERTICAL_SPACING;
	s_infiltratorDisguiseMenu.captain.generic.type		= MTYPE_PTEXT;
	s_infiltratorDisguiseMenu.captain.generic.flags		= QMF_CENTER_JUSTIFY|QMF_PULSEIFFOCUS;
	s_infiltratorDisguiseMenu.captain.generic.x			= 320;
	s_infiltratorDisguiseMenu.captain.generic.y			= y;
	s_infiltratorDisguiseMenu.captain.generic.id		= BOTS_CAPTAIN;
	s_infiltratorDisguiseMenu.captain.generic.callback	= BOTS_InfiltratorDisguiseMenu_Event; 
	s_infiltratorDisguiseMenu.captain.string			= "CAPTAIN";
	s_infiltratorDisguiseMenu.captain.color				= color_bots_menu;
	s_infiltratorDisguiseMenu.captain.style				= UI_CENTER|UI_SMALLFONT;

	y += BOTS_VERTICAL_SPACING;
	s_infiltratorDisguiseMenu.bodyguard.generic.type		= MTYPE_PTEXT;
	s_infiltratorDisguiseMenu.bodyguard.generic.flags		= QMF_CENTER_JUSTIFY|QMF_PULSEIFFOCUS;
	s_infiltratorDisguiseMenu.bodyguard.generic.x			= 320;
	s_infiltratorDisguiseMenu.bodyguard.generic.y			= y;
	s_infiltratorDisguiseMenu.bodyguard.generic.id			= BOTS_BODYGUARD;
	s_infiltratorDisguiseMenu.bodyguard.generic.callback	= BOTS_InfiltratorDisguiseMenu_Event; 
	s_infiltratorDisguiseMenu.bodyguard.string				= "BODYGUARD";
	s_infiltratorDisguiseMenu.bodyguard.color				= color_bots_menu;
	s_infiltratorDisguiseMenu.bodyguard.style				= UI_CENTER|UI_SMALLFONT;

	y += BOTS_VERTICAL_SPACING;
	s_infiltratorDisguiseMenu.sniper.generic.type		= MTYPE_PTEXT;
	s_infiltratorDisguiseMenu.sniper.generic.flags		= QMF_CENTER_JUSTIFY|QMF_PULSEIFFOCUS;
	s_infiltratorDisguiseMenu.sniper.generic.x			= 320;
	s_infiltratorDisguiseMenu.sniper.generic.y			= y;
	s_infiltratorDisguiseMenu.sniper.generic.id			= BOTS_SNIPER;
	s_infiltratorDisguiseMenu.sniper.generic.callback	= BOTS_InfiltratorDisguiseMenu_Event; 
	s_infiltratorDisguiseMenu.sniper.string				= "SNIPER";
	s_infiltratorDisguiseMenu.sniper.color				= color_bots_menu;
	s_infiltratorDisguiseMenu.sniper.style				= UI_CENTER|UI_SMALLFONT;

	y += BOTS_VERTICAL_SPACING;
	s_infiltratorDisguiseMenu.soldier.generic.type		= MTYPE_PTEXT;
	s_infiltratorDisguiseMenu.soldier.generic.flags		= QMF_CENTER_JUSTIFY|QMF_PULSEIFFOCUS;
	s_infiltratorDisguiseMenu.soldier.generic.x			= 320;
	s_infiltratorDisguiseMenu.soldier.generic.y			= y;
	s_infiltratorDisguiseMenu.soldier.generic.id		= BOTS_SOLDIER;
	s_infiltratorDisguiseMenu.soldier.generic.callback	= BOTS_InfiltratorDisguiseMenu_Event; 
	s_infiltratorDisguiseMenu.soldier.string			= "SOLDIER";
	s_infiltratorDisguiseMenu.soldier.color				= color_bots_menu;
	s_infiltratorDisguiseMenu.soldier.style				= UI_CENTER|UI_SMALLFONT;

	y += BOTS_VERTICAL_SPACING;
	s_infiltratorDisguiseMenu.berzerker.generic.type		= MTYPE_PTEXT;
	s_infiltratorDisguiseMenu.berzerker.generic.flags		= QMF_CENTER_JUSTIFY|QMF_PULSEIFFOCUS;
	s_infiltratorDisguiseMenu.berzerker.generic.x			= 320;
	s_infiltratorDisguiseMenu.berzerker.generic.y			= y;
	s_infiltratorDisguiseMenu.berzerker.generic.id			= BOTS_BERZERKER;
	s_infiltratorDisguiseMenu.berzerker.generic.callback	= BOTS_InfiltratorDisguiseMenu_Event; 
	s_infiltratorDisguiseMenu.berzerker.string				= "BERZERKER";
	s_infiltratorDisguiseMenu.berzerker.color				= color_bots_menu;
	s_infiltratorDisguiseMenu.berzerker.style				= UI_CENTER|UI_SMALLFONT;

	y += BOTS_VERTICAL_SPACING;
	s_infiltratorDisguiseMenu.infiltrator.generic.type		= MTYPE_PTEXT;
	s_infiltratorDisguiseMenu.infiltrator.generic.flags		= QMF_CENTER_JUSTIFY|QMF_PULSEIFFOCUS;
	s_infiltratorDisguiseMenu.infiltrator.generic.x			= 320;
	s_infiltratorDisguiseMenu.infiltrator.generic.y			= y;
	s_infiltratorDisguiseMenu.infiltrator.generic.id		= BOTS_INFILTRATOR;
	s_infiltratorDisguiseMenu.infiltrator.generic.callback	= BOTS_InfiltratorDisguiseMenu_Event; 
	s_infiltratorDisguiseMenu.infiltrator.string			= "INFILTRATOR";
	s_infiltratorDisguiseMenu.infiltrator.color				= color_bots_menu;
	s_infiltratorDisguiseMenu.infiltrator.style				= UI_CENTER|UI_SMALLFONT;

	y += BOTS_VERTICAL_SPACING;
	s_infiltratorDisguiseMenu.kamikazee.generic.type		= MTYPE_PTEXT;
	s_infiltratorDisguiseMenu.kamikazee.generic.flags		= QMF_CENTER_JUSTIFY|QMF_PULSEIFFOCUS;
	s_infiltratorDisguiseMenu.kamikazee.generic.x			= 320;
	s_infiltratorDisguiseMenu.kamikazee.generic.y			= y;
	s_infiltratorDisguiseMenu.kamikazee.generic.id			= BOTS_KAMIKAZEE;
	s_infiltratorDisguiseMenu.kamikazee.generic.callback	= BOTS_InfiltratorDisguiseMenu_Event; 
	s_infiltratorDisguiseMenu.kamikazee.string				= "KAMIKAZEE";
	s_infiltratorDisguiseMenu.kamikazee.color				= color_bots_menu;
	s_infiltratorDisguiseMenu.kamikazee.style				= UI_CENTER|UI_SMALLFONT;

	y += BOTS_VERTICAL_SPACING;
	s_infiltratorDisguiseMenu.nurse.generic.type		= MTYPE_PTEXT;
	s_infiltratorDisguiseMenu.nurse.generic.flags		= QMF_CENTER_JUSTIFY|QMF_PULSEIFFOCUS;
	s_infiltratorDisguiseMenu.nurse.generic.x			= 320;
	s_infiltratorDisguiseMenu.nurse.generic.y			= y;
	s_infiltratorDisguiseMenu.nurse.generic.id			= BOTS_NURSE;
	s_infiltratorDisguiseMenu.nurse.generic.callback	= BOTS_InfiltratorDisguiseMenu_Event; 
	s_infiltratorDisguiseMenu.nurse.string				= "NURSE";
	s_infiltratorDisguiseMenu.nurse.color				= color_bots_menu;
	s_infiltratorDisguiseMenu.nurse.style				= UI_CENTER|UI_SMALLFONT;

	y += BOTS_VERTICAL_SPACING;
	s_infiltratorDisguiseMenu.scientist.generic.type		= MTYPE_PTEXT;
	s_infiltratorDisguiseMenu.scientist.generic.flags		= QMF_CENTER_JUSTIFY|QMF_PULSEIFFOCUS;
	s_infiltratorDisguiseMenu.scientist.generic.x			= 320;
	s_infiltratorDisguiseMenu.scientist.generic.y			= y;
	s_infiltratorDisguiseMenu.scientist.generic.id			= BOTS_SCIENTIST;
	s_infiltratorDisguiseMenu.scientist.generic.callback	= BOTS_InfiltratorDisguiseMenu_Event; 
	s_infiltratorDisguiseMenu.scientist.string				= "SCIENTIST";
	s_infiltratorDisguiseMenu.scientist.color				= color_bots_menu;
	s_infiltratorDisguiseMenu.scientist.style				= UI_CENTER|UI_SMALLFONT;

	// skip a space
	y += BOTS_VERTICAL_SPACING;

	y += BOTS_VERTICAL_SPACING;
	s_infiltratorDisguiseMenu.cancel.generic.type		= MTYPE_PTEXT;
	s_infiltratorDisguiseMenu.cancel.generic.flags		= QMF_CENTER_JUSTIFY|QMF_PULSEIFFOCUS;
	s_infiltratorDisguiseMenu.cancel.generic.x			= 320;
	s_infiltratorDisguiseMenu.cancel.generic.y			= y;
	s_infiltratorDisguiseMenu.cancel.generic.id			= BOTS_CANCEL;
	s_infiltratorDisguiseMenu.cancel.generic.callback	= BOTS_InfiltratorDisguiseMenu_Event; 
	s_infiltratorDisguiseMenu.cancel.string				= "CANCEL";
	s_infiltratorDisguiseMenu.cancel.color				= color_bots_menu;
	s_infiltratorDisguiseMenu.cancel.style				= UI_CENTER|UI_SMALLFONT;

	Menu_AddItem( &s_infiltratorDisguiseMenu.menu, &s_infiltratorDisguiseMenu.captain );
	Menu_AddItem( &s_infiltratorDisguiseMenu.menu, &s_infiltratorDisguiseMenu.bodyguard );
	Menu_AddItem( &s_infiltratorDisguiseMenu.menu, &s_infiltratorDisguiseMenu.sniper );
	Menu_AddItem( &s_infiltratorDisguiseMenu.menu, &s_infiltratorDisguiseMenu.soldier );
	Menu_AddItem( &s_infiltratorDisguiseMenu.menu, &s_infiltratorDisguiseMenu.berzerker );
	Menu_AddItem( &s_infiltratorDisguiseMenu.menu, &s_infiltratorDisguiseMenu.infiltrator );
	Menu_AddItem( &s_infiltratorDisguiseMenu.menu, &s_infiltratorDisguiseMenu.kamikazee );
	Menu_AddItem( &s_infiltratorDisguiseMenu.menu, &s_infiltratorDisguiseMenu.nurse );
	Menu_AddItem( &s_infiltratorDisguiseMenu.menu, &s_infiltratorDisguiseMenu.scientist );
	Menu_AddItem( &s_infiltratorDisguiseMenu.menu, &s_infiltratorDisguiseMenu.cancel );
}

void BOTS_InfiltratorDisguiseMenu_f( void ) 
{
	// force as top level menu
	uis.menusp = 0;  

	// set menu cursor to a nice location
	uis.cursorx = 319;
	uis.cursory = 80;

	// setup the menu structure
	BOTS_InfiltratorDisguiseMenu_Init();

	// show the menus
	UI_PushMenu( &s_infiltratorDisguiseMenu.menu );
}
